/ .. / / -> download
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template name="contents">
	<fo:page-sequence master-reference="body-pages" initial-page-number="1"
		force-page-count="end-on-even" format="1">
		<fo:static-content flow-name="region-before-odd">
			
			<fo:table table-layout="fixed" inline-progression-dimension="100%">
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell number-columns-spanned="2" height="5mm" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
						
						<fo:table-cell number-columns-spanned="2" padding-after="2pt">
							<fo:block text-align="center"
								font-size="11pt" font-weight="bold" space-after.conditionality="retain">
								<xsl:call-template name="security"/>
								</fo:block>
						</fo:table-cell>
						<!--S1000D, Section 6.2.1, para 2.4.1.1 Publication module code
							The publication module code for the complete publication must be located in the header. The
							publication module code is located in the top outside corner and presented in 11 pt bold, aligned
							to the outer type limit. -->
						<fo:table-cell number-columns-spanned="2" padding-after="2pt">
							<fo:block text-align="end" font-size="11pt" font-weight="bold">
								<xsl:value-of select="$pmcode"/>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row padding-after="2pt">
						<fo:table-cell height="5mm" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
						<fo:table-cell number-columns-spanned="4" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
					</fo:table-row>
					<fo:table-row>
						<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
						<xsl:attribute name="border-bottom-color">black</xsl:attribute>
						<xsl:attribute name="border-bottom-width">thin</xsl:attribute>    
						<fo:table-cell height="5mm" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
						<fo:table-cell number-columns-spanned="4" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
					</fo:table-row>
				</fo:table-body>
			</fo:table>
			
		</fo:static-content>		
		
		<fo:static-content flow-name="region-after-odd">
			
			<fo:table table-layout="fixed" inline-progression-dimension="100%">
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-body>
					<fo:table-row>
						<xsl:attribute name="border-top-style">solid</xsl:attribute>
						<xsl:attribute name="border-top-color">black</xsl:attribute>
						<xsl:attribute name="border-top-width">thin</xsl:attribute>    
						<fo:table-cell number-columns-spanned="3" height="5mm" padding-before="2pt">
							
						</fo:table-cell>
						
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell height="5mm" number-columns-spanned="6" padding-before="2pt">
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell number-columns-spanned="2" height="5mm" padding-before="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell number-columns-spanned="2" padding-before="2pt">
							<fo:block text-align="center"
								font-size="11pt" font-weight="bold" space-after.conditionality="retain">
								<xsl:call-template name="security"/>
								</fo:block>
						</fo:table-cell>
						<fo:table-cell number-columns-spanned="2" padding-before="2pt">
							<fo:block text-align="end" font-size="11pt" font-weight="bold">
								<xsl:text>Page TOC-</xsl:text>
								<fo:page-number/>
							</fo:block>						
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
			
		</fo:static-content>		
		
		<fo:static-content flow-name="region-before-even">
			<fo:table table-layout="fixed" inline-progression-dimension="100%">
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-body>
					<fo:table-row>
						<fo:table-cell number-columns-spanned="2" padding-after="2pt">
							<fo:block text-align="start" font-size="11pt" font-weight="bold">
								<xsl:value-of select="$pmcode"/>				
							</fo:block>
						</fo:table-cell>
						
						<fo:table-cell number-columns-spanned="2" padding-after="2pt">
							<fo:block text-align="center"
								font-size="11pt" font-weight="bold" space-after.conditionality="retain">
								<xsl:call-template name="security"/>
							</fo:block>	
						</fo:table-cell>
						<!--S1000D, Section 6.2.1, para 2.4.1.1 Publication module code
							The publication module code for the complete publication must be located in the header. The
							publication module code is located in the top outside corner and presented in 11 pt bold, aligned
							to the outer type limit.-->
						<fo:table-cell number-columns-spanned="2" padding-after="2pt">
							<xsl:text>  </xsl:text>
						</fo:table-cell>							
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell height="5mm" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
						<fo:table-cell number-columns-spanned="4" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
					</fo:table-row>
					<fo:table-row>
						<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
						<xsl:attribute name="border-bottom-color">black</xsl:attribute>
						<xsl:attribute name="border-bottom-width">thin</xsl:attribute>    
						<fo:table-cell height="5mm" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
						<fo:table-cell number-columns-spanned="4" padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
						<fo:table-cell padding-after="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>				
					</fo:table-row>
				</fo:table-body>
			</fo:table>
		</fo:static-content>
		<fo:static-content flow-name="region-after-even">
			<fo:table table-layout="fixed" inline-progression-dimension="100%">
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-column column-width="16.7%"/>
				<fo:table-body>
					<fo:table-row>
						<xsl:attribute name="border-top-style">solid</xsl:attribute>
						<xsl:attribute name="border-top-color">black</xsl:attribute>
						<xsl:attribute name="border-top-width">thin</xsl:attribute>    
						
						<fo:table-cell number-columns-spanned="3" height="5mm" padding-before="2pt">
						</fo:table-cell>
						<fo:table-cell number-columns-spanned="3" padding-before="2pt">
							
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell height="5mm" number-columns-spanned="6" padding-before="2pt">
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell number-columns-spanned="2" height="5mm" padding-before="2pt">
							<fo:block text-align="start" font-size="11pt" font-weight="bold">
								<xsl:text>Page TOC-</xsl:text>
								<fo:page-number/>
							</fo:block>												</fo:table-cell>
						
						<fo:table-cell number-columns-spanned="2" padding-before="2pt">
							<fo:block text-align="center"
								font-size="11pt" font-weight="bold" space-after.conditionality="retain">
								<xsl:call-template name="security"/>
							</fo:block>	
						</fo:table-cell>
						<fo:table-cell number-columns-spanned="2" padding-before="2pt">
							<fo:block>
								<xsl:text> </xsl:text>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</fo:table-body>
			</fo:table>
		</fo:static-content>				
		<fo:flow flow-name="region-body" white-space-collapse="true">
			<fo:marker marker-class-name="blank-page"> </fo:marker>
			<fo:marker marker-class-name="end-of-dm"> </fo:marker>
				

			<fo:table xsl:use-attribute-sets="standard.table.setup.no.border" >
				<fo:table-column column-number="1" column-width="100%"/>
				<fo:table-header text-align="left" space-before="10pt" space-after="10pt">							
					<fo:table-row>
						<fo:table-cell>
							<fo:block font-size="14pt" font-weight="bold" text-align="center" keep-with-next="auto"
								break-before="page" span="all" margin-top="13pt" margin-bottom="14pt">
								<xsl:text>TABLE OF CONTENTS</xsl:text>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
						<fo:table-cell>
							<fo:block space-before="1pc" text-align="right" xsl:use-attribute-sets="column-title"  margin-bottom="14pt">
								<xsl:text>DM Sequence No.</xsl:text>
							</fo:block>
						</fo:table-cell>						
					</fo:table-row>
				</fo:table-header>
				<fo:table-body>
						<xsl:apply-templates mode="toc" select="//pm/content"/>	
				</fo:table-body>
				</fo:table>
		</fo:flow>
	</fo:page-sequence>
</xsl:template>		

<xsl:template match="content" mode="toc">
	<xsl:apply-templates select="pmEntry" mode="toc"/>
</xsl:template>

<xsl:template mode="toc" match="pmEntry">
	<xsl:apply-templates mode="toc"/>
</xsl:template>

<xsl:template match="pmEntryTitle" mode="toc">
	<fo:table-row keep-with-next.within-page="always">
		<fo:table-cell>
			<fo:block margin-top="6pt" margin-bottom="6pt">
				<xsl:if test="../@pmEntryType='pmt52'">
					<xsl:text>CHAPTER </xsl:text>
					<xsl:value-of select="count(preceding::pmEntry[@pmEntryType = 'pmt52'])+1"/>
					<xsl:text> </xsl:text>
				</xsl:if>
				<xsl:apply-templates/>			
			</fo:block>
		</fo:table-cell>
	</fo:table-row>

</xsl:template>
	
<xsl:template match="dmRef" mode="toc">
	<xsl:apply-templates select="dmRefIdent" mode="toc"/>

</xsl:template>

<xsl:template match="pmEntry/dmRef/dmRefIdent" mode="toc">
	<xsl:if test="not(dmCode/@infoCode='012' and dmCode/@infoCodeVariant='J') 
		and not(dmCode/@infoCode='00S' and dmCode/@infoCodeVariant='A') 
		and not(dmCode/@infoCode='001' and dmCode/@infoCodeVariant='A')">
	<fo:table-row text-align-last="justify">
		<fo:table-cell>
			<fo:block text-align-last="justify" margin-bottom="3pt">
				<xsl:variable name="countAsPoint">
					<xsl:choose>
						<xsl:when test="../@changeType='add'">
							<xsl:value-of select="1"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="0"/>
						</xsl:otherwise>
					</xsl:choose>               
				</xsl:variable>
				<xsl:variable name="countThisDm">
					<xsl:choose>
						<xsl:when test="../@changeType='add'">
							<xsl:value-of select="0"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="1"/>
						</xsl:otherwise>
					</xsl:choose>               
				</xsl:variable>       
				<xsl:variable name="countAdds">
					<xsl:number count="dmRef[not(attribute::changeType='add')]" from="content"/>
					<!--            <xsl:value-of select="format-number(count(preceding::dmRef[attribute::changeType='add'])+$countAsPoint,'00')"/>
					-->
				</xsl:variable>
				<xsl:variable name="dmSeq">
					<xsl:value-of select="format-number(count(preceding::dmRef[not(attribute::changeType='add')])+$countThisDm,'0000')"/>
				</xsl:variable>
				<xsl:variable name="dmCount">
					<xsl:value-of select="$dmSeq"/>
					<xsl:if test="$countAsPoint='1'">
						<xsl:text>.</xsl:text>
						<xsl:value-of select="$countAdds"/>
					</xsl:if>
				</xsl:variable>
				<fo:basic-link>
					<xsl:attribute name="internal-destination">
						<xsl:apply-templates select="dmCode"/>											
					</xsl:attribute>
					<xsl:text>  </xsl:text>
					<xsl:apply-templates select="../dmRefAddressItems/dmTitle" mode="toc"/>
					<xsl:text> [</xsl:text>
					<xsl:apply-templates select="dmCode"/>
					<xsl:text>] </xsl:text>
					<fo:leader leader-pattern="use-content">. </fo:leader>
					<xsl:value-of select="$dmCount"/>
					
				</fo:basic-link> 		
			</fo:block>
		</fo:table-cell>
	</fo:table-row>
	</xsl:if>
</xsl:template>
	
<xsl:template match="dmTitle" mode="toc">
	<xsl:value-of select="techName"/>
	<xsl:text> - </xsl:text>
	<xsl:value-of select="infoName"/>
</xsl:template>



</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
<metaInformation>
<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
</metaInformation>
-->

/ gopher://khzae.net/0/s1000d/links/projects/3031/Army S1000D Stylesheets/FO-3031-A00-USARMY-TOC_001-00_EN-US.xsl
Styles: Light Dark Classic